/*
 * @LastEditTime: 2023-03-18 11:26:57
 * @Method: 
 * @Description: 
 */
package Preview.meituan;

import java.util.Arrays;
import java.util.Scanner;

public class Main1 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int x = sc.nextInt();
        int y = sc.nextInt();
        int[] xs = new int[n];
        int[] ys = new int[n];
        for (int i = 0;i < n;i++) {
            xs[i] = sc.nextInt();
        }
        for (int i = 0;i < n;i++) {
            ys[i] = sc.nextInt();
        }
        int[][] pos = new int[n][2];
        for (int i = 0;i < n;i++) {
            pos[i] = new int[]{xs[i], ys[i]};
        }
        Arrays.sort(pos, (o1, o2) -> {
            return Integer.compare(o1[0], o2[0]);
        });
        for (int i = 0;i < n;i++) {
            System.out.println(Arrays.toString(pos[i]));
        }
        int maxRes = 0;
        for (int i = 0;i < n;i++) {
            int res = 0;
            int a = pos[i][0];
            int b = pos[i][1];
            int ta = a + x;
            int tb = b + y;
            for (int j = 0;j < n;j++) {
                int[] t = pos[j];
                if (t[0] > ta) {
                    break;
                }
                if (a <= t[0] && t[0] <= ta && b <= t[1] && t[1] <= tb) {
                    res++;
                }
            }
            maxRes = Math.max(maxRes, res);
        }
        System.out.println(maxRes);
    }
}